Skip to content

[diffs] Fix unified diff patches with sql comments#796

Merged
amadeus merged 3 commits into
mainfrom
amadeus/patch-file-bug
Jun 10, 2026
Merged

[diffs] Fix unified diff patches with sql comments#796
amadeus merged 3 commits into
mainfrom
amadeus/patch-file-bug

Conversation

@amadeus

@amadeus amadeus commented Jun 10, 2026

Copy link
Copy Markdown
Member

Fixes a funky case where unified diff headers can be parsed out of an existing hunk.

This also lead me down the path a bit of generally making the parser a bit stronger against malformed diffs.

The example that triggered the bug:

--- sql/test.sql
+++ sql/test.sql
@@ -1,5 +1,4 @@
 -- This is a test sql file
--- This is an sql comment
 
 CREATE TABLE users (
 	id BIGSERIAL PRIMARY KEY,

Fixes #793

amadeus added 2 commits June 9, 2026 16:25
Fix the original issue found from the bug report, but also harden
parsing a bit more
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Ready Ready Preview Jun 10, 2026 2:01am
pierre-docs-diffshub Ready Ready Preview Jun 10, 2026 2:01am
pierre-docs-trees Ready Ready Preview Jun 10, 2026 2:01am
pierrejs-diff-demo Ready Ready Preview Jun 10, 2026 2:01am

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6a26f2be3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/diffs/src/utils/parsePatchFiles.ts Outdated
@amadeus

amadeus commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@amadeus amadeus merged commit f76d0fa into main Jun 10, 2026
13 checks passed
@amadeus amadeus deleted the amadeus/patch-file-bug branch June 10, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: PatchDiff component throws error when receiving patch string with deleted sql comments

1 participant